package listasGenericas;

import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.model.SelectItem;

@ManagedBean
@ViewScoped
public class Roles implements Serializable {

    private SelectItem[] roles;
    private SelectItem[] rolesEmpleados;
    private SelectItem[] rolesFiltro;

    public Roles() {

        roles = new SelectItem[7];
        roles[0] = new SelectItem("", "Seleccione...");
        roles[1] = new SelectItem(1, "Caja");
        roles[2] = new SelectItem(2, "Chofer");
        roles[3] = new SelectItem(3, "Cliente");
        roles[4] = new SelectItem(4, "Maitre");
        roles[5] = new SelectItem(5, "Mozo");
        roles[6] = new SelectItem(6, "Super Usuario");
        
        rolesEmpleados = new SelectItem[6];
        rolesEmpleados[0] = new SelectItem("", "Seleccione...");
        rolesEmpleados[1] = new SelectItem(1, "Caja");
        rolesEmpleados[2] = new SelectItem(2, "Chofer");
        rolesEmpleados[3] = new SelectItem(4, "Maitre");
        rolesEmpleados[4] = new SelectItem(5, "Mozo");
        rolesEmpleados[5] = new SelectItem(6, "Super Usuario");
        
        rolesFiltro = new SelectItem[7];
        rolesFiltro[0] = new SelectItem("", "TODOS");
        rolesFiltro[1] = new SelectItem(1, "Caja");
        rolesFiltro[2] = new SelectItem(2, "Chofer");
        rolesFiltro[3] = new SelectItem(3, "Cliente");
        rolesFiltro[4] = new SelectItem(4, "Maitre");
        rolesFiltro[5] = new SelectItem(5, "Mozo");
        rolesFiltro[6] = new SelectItem(6, "Super Usuario");

    }

    public String devolverNombreRolPorId(int id) {
        return roles[id].getLabel();
    }

    public SelectItem[] getRoles() {
        return roles;
    }

    public void setRoles(SelectItem[] roles) {
        this.roles = roles;
    }

    public SelectItem[] getRolesEmpleados() {
        return rolesEmpleados;
    }

    public void setRolesEmpleados(SelectItem[] rolesEmpleados) {
        this.rolesEmpleados = rolesEmpleados;
    }
    
    public String devolverNombreRolPorIdEmpleado(int id) {
        return rolesEmpleados[id].getLabel();
    }

    public SelectItem[] getRolesFiltro() {
        return rolesFiltro;
    }

    public void setRolesFiltro(SelectItem[] rolesFiltro) {
        this.rolesFiltro = rolesFiltro;
    }
    
}
